package com.swf.seed.jolt;

import java.util.List;
import java.util.ArrayList;

/**
 * <p>Title: 连接池配置类</p>
 * <p>Description: 可以配置多个连接池.</p>
 * <p>Copyright: Copyright (c) 2009</p>
 * <p>Company: Beijing Watchdata CO,.Ltd</p>
 * @author da.wang
 * @version 1.0
 */
public class PoolJoltConfig {
    List poolItem = null;
    public PoolJoltConfig() {
        poolItem = new ArrayList();
    }

    /**
     * 增加一个池配置
     * @param item PoolConfigItem
     */
    public void addPoolItem( PoolConfigItem item ) {
        poolItem.add( item );
    }

    /**
     * 获取连接池配置的数量
     * @return int 数量
     */
    public int getConfigCount() {
        return poolItem.size();
    }

    /**
     * 得到连接池配置
     * @param index int 索引
     * @return PoolConfigItem 连接池配置
     */
    public PoolConfigItem getPoolItem( int index ) {
        if ( index < 0 || index >= poolItem.size() ) {
            throw new IndexOutOfBoundsException( "*******Index out of bounds: size=" + poolItem.size()
                                                 + " index=" + index );
        }
        return (PoolConfigItem)poolItem.get( index );
    }
}
